package com.hc.componentspringboot.service.impl;

import com.hc.componentspringboot.bean.Authority;
import com.hc.componentspringboot.bean.Customer;
import com.hc.componentspringboot.repository.AuthorityRespository;
import com.hc.componentspringboot.repository.CustomerRespository;
import com.hc.componentspringboot.service.CustomerService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CustomerServiceImpl implements CustomerService {
    @Autowired
    private CustomerRespository customerRespository;
    @Autowired
    private AuthorityRespository authorityRespository;
    @Override
    public Customer getCustomer(String username) {
        Customer customer = customerRespository.findByUsername(username);
        return customer;
    }

    @Override
    public List<Authority> getCustomerAuthority(String username) {
        List<Authority> authorityList = authorityRespository.findAuthoritysByUsername(username);
        return authorityList;
    }
}
